package IC.Semantics.symbols;

import IC.AST.Type;
import IC.Semantics.SemanticError;
import IC.Semantics.types.AllMightyType;
import IC.Semantics.types.SemanticType;
import IC.Semantics.types.TypeTable;

public class VariableSymbol extends SemanticSymbol
{ 
	/**
	 * standard constructor
	 * @param name
	 * @param type
	 * @throws SemanticError
	 */
	public VariableSymbol(String name, Type type){
		super(name, type.getLine(), TypeTable.getType(type), SemanticKind.VARIABLE);
	}
	
	/**
	 * constructor when using forward referencing
	 * @param name
	 * @param type
	 * @param fref
	 * @throws SemanticError
	 */
	public VariableSymbol(String name) {
		super(name, 0, new AllMightyType(), SemanticKind.PARAM, true);
	}
	
	/**
	 * constructor for 'this' symbol on method symbol table
	 * @param type
	 * @throws SemanticError
	 */
	public VariableSymbol(String name, int line)
	{
		super(MethodSymbolTable.THIS_VAR_NAME, line, TypeTable.getClassType(name), SemanticKind.VARIABLE);
	}
	
	/**
	 * constructor using provided semantic type
	 * @param name
	 * @param line
	 * @param type
	 * @throws SemanticError
	 */
	public VariableSymbol(String name, int line, SemanticType type)
	{
		super(name, line, type, SemanticKind.VARIABLE);
	}

	// variable to declare if the symbol has been initialized
	public boolean isInit;
}
